﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XinjeMesProgram.Entities.Function
{
    public class MaintenancesQuery
    {
        public static int GetFixUnder6(string Code)
        {
            int info = 0;
            if (!string.IsNullOrEmpty(Code))
            {
                using (FactoryMesContext factoryMes = new FactoryMesContext())
                {
                    var query = factoryMes.RepairProduct.Count(x => x.Code == Code && x.State == "1" && x.RepairCompletedTime <= DateTime.Now && x.RepairCompletedTime >= DateTime.Now.AddMonths(-6));
                    info = query;

                }
            }

            return info;
        }
    }
}
